<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.min.js"></script>
</head>
<body>
     <form action="/calc/sum" method="get">
        <h1>计算器</h1>
        数字1：<input name="num1" type="text" id="n1"><br>
        数字2：<input name="num2" type="text" id="n2"><br>
        <input type="button" value=" 点击相加 "  onclick="transferParam()">
    </form>
    <script>
        function transferParam(){
            $.ajax({
                type:"post",
                url:"/calc/param",
                data:{
                    num1:$("#n1").val(),
                    num2:$("#n2").val(),
                },
                success:function(result){
                    if(result==true){
                        location.href="/calc2.html";
                    }else{
                        alert("请规范输入");
                    }
                }
            });
        }
    </script>

</body>
</html>